package main.java.com.uc.training.smadmin.bd.dao.impl;

import com.uc.training.smadmin.bd.dao.MemberRechargeHistoryDao;
import com.uc.training.smadmin.bd.model.MemberRechargeHistory;
import com.uc.training.smadmin.bd.re.MemberRechargeHistoryListRE;
import com.uc.training.smadmin.bd.vo.MemberRechargeHistoryVO;
import com.zuche.framework.dao.CarIsIbatisDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 版权声明： Copyright (c) 2008 ucarinc. All Rights Reserved.
 *
 * @author 何麒（qi.he@ucarinc.com）
 * @Version 1.0
 * @date 2018/11/15
 */
@Repository
public class MemberRechargeHistoryDaoImpl extends CarIsIbatisDaoImpl implements MemberRechargeHistoryDao {
    /**
     * 新增充值记录
     *
     * @param memberRechargeHistory
     * @return
     */
    @Override
    public Long insertMemberRechargeHistory(MemberRechargeHistory memberRechargeHistory) {
        return (Long) this.insert("com.uc.training.smadmin.bd.dao.MemberRechargeHistoryDao.insertMemberRechargeHistory", memberRechargeHistory);
    }

    /**
     * 根据会员id获取充值记录
     *
     * @param memberRechargeHistoryVO
     * @return
     */
    @Override
    public List<MemberRechargeHistoryListRE> getRechargeHistoryListByMemberId(MemberRechargeHistoryVO memberRechargeHistoryVO) {
        return this.queryForList("com.uc.training.smadmin.bd.dao.MemberRechargeHistoryDao." +
                "getRechargeHistoryListByMemberId", memberRechargeHistoryVO, memberRechargeHistoryVO.getStartIndex(),
                memberRechargeHistoryVO.getEndIndex());
    }

    /**
     * 根据会员id获取总记录数
     *
     * @param memberId
     * @return
     */
    @Override
    public Integer getCountByMemberId(Long memberId) {
        return (Integer) this.queryForObject("com.uc.training.smadmin.bd.dao.MemberRechargeHistoryDao.getCountByMemberId", memberId);
    }
}
